from django.conf.urls.defaults import *


# Uncomment the next two lines to enable the admin:
from django.contrib import admin
from django.conf import settings
admin.autodiscover()



urlpatterns = patterns('szachy.views',    
    (r'^$', 'index', {}, 'index'),
    (r'^initiate_match/', 'initiate_match', {}, 'initiate_match'),
    (r'^match/decline/(?P<game_id>\d+)/$', 'decline_match', {}, 'decline_match'),
    (r'^select_side/(?P<game_id>\d+)/(?P<side>[wb])/$', 'select_side', {}, 'select_side'),
    #(r'^canvas/match/configure/(?P<game_id>\d+)/$', 'configure_match', {}, 'configure_match'),
    (r'^match/(?P<game_id>\d+)/$', 'game', {}, 'game'),
    (r'^match/(?P<game_id>\d+)/my_move/$', 'my_move_ajax', {}, 'my_move_ajax'),
    (r'^invite/$', 'invite', {}, 'invite'),
    (r'^match/vs/(?P<opponent_id>\d+)/$', 'accept_invitation', {}, 'accept_invitation'),
    (r'^players_list/$', 'players', {'page': '1'}, 'players'),
    (r'^players_list/(?P<page>\d+)/$', 'players', {}, 'players_paginated'),
    (r'^invite_to_game/(?P<player_id>\d+)/$', 'invite_to_game', {}, 'invite_to_game'),
    (r'^match/(?P<game_id>\d+)/chessboard/$', 'get_chessboard', {}, 'get_chessboard'),
    (r'^match/(?P<game_id>\d+)/result/$', 'game_result', {}, 'game_result'),
    (r'^match/(?P<game_id>\d+)/make_move/$', 'make_move', {}, 'make_move'),
)

urlpatterns += patterns('',
    (r'^admin/', include(admin.site.urls)),
)


if settings.DEBUG:
    urlpatterns +=  patterns('', (r'^media/(?P<path>.*)$', 'django.views.static.serve',
        {'document_root': settings.MEDIA_ROOT}),)
